package com.ce.pms.occupation.dao.impl;

import java.util.List;

import com.ce.pms.base.dao.impl.PmsBaseDaoImpl;
import com.ce.pms.occupation.dao.IThingGivebackDao;
import com.ce.pms.occupation.model.ThingGivebackDO;

/**
 * 物品归还DAO
 * @author 王浩羽
 *
 */
public class ThingGivebackDaoImpl extends PmsBaseDaoImpl<ThingGivebackDO> implements IThingGivebackDao
{	
	public ThingGivebackDO getThingGivebackByThingEntrustId(Long thingEntrustId){
		StringBuilder hqlBuilder = new StringBuilder();
		hqlBuilder.append("SELECT OBJ FROM ").append(ThingGivebackDO.class.getSimpleName()).append(" OBJ where OBJ.thingEntrust.keyword = ? ");
		List<ThingGivebackDO> list = this.createQuery(hqlBuilder.toString(), thingEntrustId).list();
		if(list==null || list.isEmpty())
		{
			return null;
		}
		return list.get(0);
	}
}
